import { useEffect, useState } from 'react';
import useInterval from './hooks/useInterval2';

function App() {
  const [count, setCount] = useState(0);

  useEffect(() => {
    const clearInterval = useInterval(() => {
      setCount(prev => prev + 1);
    }, 1000);

    // 清理函数
    return () => clearInterval();
  }, []);

  return <div>Count: {count}</div>;
}

export default App;